from django.conf.urls.defaults import patterns, include, url
from django.contrib import admin
from django.contrib.auth.views import login, logout
from django.views.generic import DetailView, ListView
from CourseHub.models import Course, School, University, User, UserProfile, Comment
admin.autodiscover()

urlpatterns = patterns('',
    # Admin
    (r'^admin/', include(admin.site.urls)),
    
    # Static Path
    (r'^static/(?P<path>.*)$', 'serve'),
    
    # User Auth
    (r'^register/$', 'CourseHub.views.Register'),
    (r'^redirect/$','django.contrib.auth.views.logout', {'template_name': 'redirect.html'}),
    (r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}),
    (r'^accounts/logout/$','django.contrib.auth.views.logout', {'template_name': 'login.html'}),
    
    # Course & Comment
    (r'^course/$', 'CourseHub.views.PopularCourse'),
    (r'^course/(?P<course_id>\d+)/$', 'CourseHub.views.CourseDetail'),
    (r'^create/$', 'CourseHub.views.CreateCourse'),
    (r'^comment/$', 'CourseHub.views.LatestComment'),

    # Search
    (r'^search/$', 'CourseHub.views.AdvanceSearch'),

    # Main Page
    (r'^$', 'CourseHub.views.PopularCourse'),
    )




